import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'


// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
   devServer: {
    port: 8080  // 改为未被占用的端口（如 8080/5173 等）
  },
  compatibilityDate: '2024-08-06',
  devtools: { enabled: true },
  modules: ['@unocss/nuxt', "nuxtjs-naive-ui", '@nuxt/icon'],
  vite: {
    plugins: [
      AutoImport({
        imports: [
          {
            'naive-ui': []
          }
        ]
      }),
      Components({
        resolvers: [NaiveUiResolver()]
      }),
    ]
  },
  css: [
    'assets/styles/reset.css',
  ],
  icon: {
    customCollections: [
      {
        prefix: 'cus',
        dir: './public/icons'
      },
    ],
  },
  unocss: {
    preflight: false,
  },
  // // naive-ui
  // build: {
  //   transpile:
  //     process.env.NODE_ENV === 'production'
  //       ? ['naive-ui', 'vueuc', '@css-render/vue3-ssr', '@juggle/resize-observer']
  //       : ['@juggle/resize-observer'],
  // },
})